package com.roy.minimq.namesrv.service;

import com.roy.minimq.namesrv.applicaton.NamesrvController;
import com.roy.minimq.remoting.service.ChannelEventListener;
import io.netty.channel.Channel;

public class BrokerHousekeepingService implements ChannelEventListener {

    private NamesrvController controller;

    public BrokerHousekeepingService(NamesrvController controller) {
        this.controller = controller;
    }

    @Override
    public void onChannelConnect(String remoteAddr, Channel channel) {

    }

    @Override
    public void onChannelClose(String remoteAddr, Channel channel) {
        this.controller.getRouteInfoManager().onChannelDestroy(remoteAddr,channel);
    }

    @Override
    public void onChannelException(String remoteAddr, Channel channel) {
        this.controller.getRouteInfoManager().onChannelDestroy(remoteAddr,channel);
    }

    @Override
    public void onChannelIdle(String remoteAddr, Channel channel) {
        this.controller.getRouteInfoManager().onChannelDestroy(remoteAddr,channel);
    }
}
